<div class="billing_admin">
    Просмотр результатов:
    <a href="/billing/admin/orders/result/?show=year">За год</a>
    <a href="/billing/admin/orders/result/?show=month">За месяц</a>
    <br>
    <?php
    $result=round($result[0][0]['SUM(cost)'],2);
    echo $outxtx.$result."$<br>";
	$data_incomes=round($data_incomes[0][0]['SUM(`income`)'],2);
	echo "Заработано за период: ".$data_incomes."$";
    echo "<hr>";
    echo '<script type="text/javascript" src="https://www.google.com/jsapi"></script>
         <script type="text/javascript">
             google.load("visualization", "1", {packages:["corechart"]});
             google.setOnLoadCallback(drawChart);
             function drawChart() {
                 var data = google.visualization.arrayToDataTable([
                     [\'Time\', \'Income $\'],
    ';
    foreach($data_lines as $line)
    {
        $time=$line['income_log']['time'];
        $time=date("d.m.Y",$time);
        $income=$line['income_log']['income'];
        echo "['$time',  $income],";
    }
    echo '
    ]);
    var options = {
      title: \'RH Income\'
    };

    var chart = new google.visualization.LineChart(document.getElementById(\'chart_div\'));
    chart.draw(data, options);
  }
   </script>';
   echo '<div id="chart_div"></div>';
?>
</div>